package com.guli.product.entity;

import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import com.guli.common.validation.AddValidation;
import com.guli.common.validation.ListValue;
import com.guli.common.validation.UpdateValidation;
import lombok.Data;
import org.hibernate.validator.constraints.URL;

import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Null;
import javax.validation.constraints.Pattern;
import java.io.Serializable;

/**
 * 品牌
 *
 * @author zzb
 * @email 1626131069@qq.com
 * @date 2023-10-21 10:18:56
 */
@Data
@TableName("pms_brand")
public class BrandEntity implements Serializable {
    private static final long serialVersionUID = 1L;
    /**
     * 品牌id
     */
    @TableId
    @Null(message = "新增时品牌ID必须为空", groups = AddValidation.class)
    @NotNull(message = "修改时品牌ID不能为空", groups = UpdateValidation.class)
    private Long brandId;
    /**
     * 品牌名
     */
    @NotNull(message = "品牌名不能为空")
    private String name;
    /**
     * 品牌logo地址
     */
    @NotNull(message = "logo地址不能为空")
    @URL(message = "logo地址必须是一个合法的URL地址", groups = AddValidation.class)
    private String logo;
    /**
     * 介绍
     */
    @NotNull(message = "介绍不能为空")
    private String descript;
    /**
     * 显示状态[0-不显示；1-显示]
     */
    @ListValue(value = {0, 1},groups = UpdateValidation.class)
    @TableLogic
    private Integer showStatus;
    /**
     * 检索首字母
     */
    @Pattern(regexp = "^[a-zA-Z]$", message = "检索首字母必须是一个字母", groups = {AddValidation.class, UpdateValidation.class})
    @NotNull(message = "检索字母不能为空", groups = {AddValidation.class, UpdateValidation.class})
    private String firstLetter;
    /**
     * 排序
     */
    @Min(value = 0, message = "排序必须大于或等于0")
    @NotNull(message = "排序不能为空")
    private Integer sort;

}
